Skip to content

Add documentation for GA4 tracking#3014

Open
davidtrussler wants to merge 2 commits into
mainfrom
GA4-documentation
Open

Add documentation for GA4 tracking#3014
davidtrussler wants to merge 2 commits into
mainfrom
GA4-documentation

Conversation

@davidtrussler
Copy link
Copy Markdown
Contributor

@davidtrussler davidtrussler commented Dec 1, 2025

This adds some documentation for the GA4 tracking work on Publisher. It is a work in progress: it covers what has been added so far and will expand as more features are added. Most usefully it covers how to test the work locally in a section that can be referenced in future PRs.

@davidtrussler davidtrussler marked this pull request as ready for review December 1, 2025 16:15
Copy link
Copy Markdown
Contributor

@hezzimo hezzimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of queries

Comment thread docs/ga4-tracking.md Outdated

Tracking is added to Publisher via GA4. The full documentation is avaialable in [GA4 Publishing Implementation guide](https://docs.google.com/document/d/19RaqZttDTZXsgX4k87wAAOhsol1STM3iTPPPKNlXRl0/edit?tab=t.0#heading=h.eo3rk3rxuz4n).

Via this means we are tracking:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is helpful. Might just be my addled 🧠 😄 but I wonder if this could be clearer if it read 'Via GA4 we are tracking':?

Comment thread docs/ga4-tracking.md
- run `window.GOVUK.analyticsGa4.showDebug = true` in the browser console. The console will then display the tracking data for all user interactions with the form as they occur.

Running `window.dataLayer` in the browser console at any point will display the data that has been collected during user interactions with the page. In this work we are interested in the "event_data" events. There should be one of these for each user event with the form since the page was loaded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be irrelevant but did you mention having to prevent a form from submitting at some point, in order to see the tracking fully? Just wondered if it would be worth adding that info here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's kind of an alternative to setting "Preserve log" in the console, and probably a better one because it means you can observe what data gets sent without actually saving. I've put that instead and also update the reference to the dataLayer later in a way that makes more sense in that context.

- Add reference to doc in README
- Add tracking doc
- Make text change for clarity
- Replace reference to "Preserve log" with disabling the form submission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants